<template>
  <div>
    <table
      width="400"
      border="0"
      align="center"
      cellpadding="0"
      cellspacing="1"
      class="mars"
    >
      <tbody>
        <tr bgcolor="#fba661" height="30">
          <td width="123" height="20" align="right" bgcolor="#f3f3f3">
            项目类别名称
          </td>
          <td width="11" align="right" bgcolor="#f3f3f3">&nbsp;</td>
          <td height="20" colspan="2" align="left" bgcolor="#f3f3f3">
            <div align="left">
              <input
                type="text"
                id="temp1"
                v-model="projectCategory.categoryname"
                name="categoryname"
              />
            </div>
          </td>
        </tr>
        <tr bgcolor="#e4f1fe">
          <td height="20" bgcolor="#f3f3f3">
            <div align="right">分配专家</div>
          </td>
          <td bgcolor="#f3f3f3">&nbsp;</td>
          <td height="20" colspan="2" align="left" bgcolor="#f3f3f3">
            <div align="left">
              <select
                size="1"
                v-model="userActive"
                @change="changeProduct($event)"
              >
                <option
                  v-for="(item, index) in userList"
                  :key="index"
                  :value="item.expertid"
                >
                  {{ item.name }}
                </option>
              </select>
            </div>
          </td>
        </tr>
        <tr bgcolor="#e4f1fe">
          <td height="20" bgcolor="#f3f3f3">
            <div align="right">项目申报开始时间</div>
          </td>
          <td bgcolor="#f3f3f3">&nbsp;</td>
          <td height="20" colspan="2" align="left" bgcolor="#f3f3f3">
            <input
              type="text"
              id="temp2"
              name="repStartTime"
              v-model="projectCategory.repStartTime"
              onFocus="setday(this)"
            />
          </td>
        </tr>
        <tr bgcolor="#e4f1fe">
          <td height="20" bgcolor="#f3f3f3">
            <div align="right">项目申报结束时间</div>
          </td>
          <td bgcolor="#f3f3f3">&nbsp;</td>
          <td height="20" colspan="2" align="left" bgcolor="#f3f3f3">
            <span class="STYLE1">警告：结束时间不能小于当前系统时间</span>
          </td>
        </tr>
        <tr bgcolor="#e4f1fe">
          <td height="20" bgcolor="#f3f3f3">
            <div align="right"></div>
          </td>
          <td bgcolor="#f3f3f3">&nbsp;</td>
          <td height="20" colspan="2" align="left" bgcolor="#f3f3f3">
            <input
              type="text"
              id="temp3"
              name="repStopTime"
              v-model="projectCategory.repStopTime"
              onFocus="setday(this)"
            />
          </td>
        </tr>
        <tr bgcolor="#e4f1fe">
          <td height="30" bgcolor="#f3f3f3">&nbsp;</td>
          <td bgcolor="#f3f3f3">&nbsp;</td>
          <td width="73" height="30" align="left" bgcolor="#f3f3f3">
            <input
              type="submit"
              name="Submit3"
              value="提交"
              @click="addProjectCategory()"
            />
          </td>
          <td width="188" height="30" align="left" bgcolor="#f3f3f3">
            <input type="submit" name="Submit22" value="取消" />
          </td>
        </tr>
      </tbody>
    </table>
    <div id="container">
      <div id="footer">
        <p>
          <a href="http://www.ascenttech.com.cn/" target="_blank"
            >版权所有：北京亚思晟商务科技有限公司
            &copy;2004-2008|京ICP备05005681</a
          >
        </p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
    data: function() {
return {
        projectCategory: {
            categoryid: '',
            expertid: '2',
            categoryname: '',
            repStartTime: '',
            repStopTime: '',
            expStartTime: '',
            expStopTime: ''

        },
        expertView:{
            expertid:'',
            name:''
        },
        userList:'',
        userActive:'',//获取被选中的value值 默认选中的是1(管理员)

    };
},
    mounted(){
        this.$axios.get("http://localhost:8080/api/admin/getExpertView")
            .then((resp)=>{
                this.userList=resp.data.data;
                console.log(resp.data.code+" "+resp.data.msg);
            })
    },
    methods:{
        changeProduct(event) {
            this.userActive = event.target.value; //获取option对应的value值
            this.projectCategory.expertid=this.userActive;
            console.log("你选中了",this.userActive);
            console.log(this.user);
        },
        addProjectCategory:function (){
            this.$axios.post(
                "http://localhost:8080/api/admin/addProjectCategory",
                this.projectCategory
            )
                .then((resp)=>{
                    console.log(resp.data.code+" "+resp.data.msg);
                    location.href="/declare/admin/showProjectCategorys";
                })
        }
    }
};
</script>

<style>
</style>